package com.rms.server.Service;

import com.rms.server.Dao.IngredientMapper;
import com.rms.server.Domain.Ingredient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class IngredientService {

    @Autowired
    private IngredientMapper ingredientMapper;

    public int addIngredient(Ingredient ingredient) {
        return ingredientMapper.insertIngredient(ingredient);
    }

    public int removeIngredient(Long ingredientId) {
        return ingredientMapper.deleteIngredient(ingredientId);
    }

    public int modifyIngredient(Ingredient ingredient) {
        return ingredientMapper.updateIngredient(ingredient);
    }

    public Ingredient getIngredientById(Long ingredientId) {
        return ingredientMapper.selectIngredientById(ingredientId);
    }

    public List<Ingredient> getAllIngredients() {
        return ingredientMapper.selectAllIngredients();
    }
}